﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Collections;

namespace eBook.Core.BusinessObjects
{
  public class boBook
  {
    [Required]
    [DisplayName("BookID")]
    public int BookID { get; set; }

    [DisplayName("ISBN10")]
    public string ISBN10 { get; set; }

    [DisplayName("ISBN13")]
    public string ISBN13 { get; set; }

    [DisplayName("ASIN")]
    public string ASIN { get; set; }

    [DisplayName("LCCN")]
    public string LCCN { get; set; }

    [DisplayName("DeweyDecimal")]
    public string DeweyDecimal { get; set; }

    [DisplayName("Title")]
    public string Title { get; set; }

    [DisplayName("Subtitle")]
    public string Subtitle { get; set; }

    [DisplayName("PublisherID")]
    public int? PublisherID { get; set; }

    [DisplayName("Publisher")]
    public string PublisherName { get; set; }

    [DisplayName("NumberOfPages")]
    public int? NumberOfPages { get; set; }

    [DisplayName("Edition")]
    public string Edition { get; set; }

    [DisplayName("AmazonRating")]
    public string AmazonRating { get; set; }

    [DisplayName("EditorialReview")]
    public string EditorialReview { get; set; }

    [DisplayName("PublicationDate")]
    public string PublicationDate { get; set; }

    [DisplayName("SmallImageURL")]
    public string SmallImageURL { get; set; }

    [DisplayName("MediumImageURL")]
    public string MediumImageURL { get; set; }

    [DisplayName("LargeImageURL")]
    public string LargeImageURL { get; set; }

    //[DisplayName("FilePath")]
    //public string FilePath { get; set; }

    [DisplayName("FilePath")]
    public string Path { get; set; }

    [DisplayName("FileName")]
    public string FileName { get; set; }

    [DisplayName("RelativePath")]
    public string RelativePath 
    { 
      get 
      {
        if ( string.IsNullOrEmpty(this.Path) || string.IsNullOrEmpty(this.FileName) )
          return string.Empty;

        return string.Format("{0}\\{1}", this.Path, this.FileName); 
      } 
    }

    [DisplayName("Authors")]
    public boAuthor[] Authors{ get; set; }

    [DisplayName("Authors")]
    public string AuthorsAsText 
    { 
      get 
      {
        var names = from x in this.Authors select x.Name;
        return string.Join(", ", names); 
      } 
    }

    [DisplayName("Links")]
    public boLink[] Links{ get; set; }

    [DisplayName("Topics")]
    public boTopic[] Topics { get; set; }

    [DisplayName("Categories")]
    public boCategory[] Categories { get; set; }

    [DisplayName("DateCreated")]
    public DateTime? DateCreated { get; set; }

    [DisplayName("DateModified")]
    public DateTime? DateModified { get; set; }
  }



}
